﻿using Jay.Sc2.Bof.Lib.State;

namespace Jay.Sc2.Bof.Lib.Action.Zerg
{
	public class ActionProduceInfestor : ActionProduceFromLarva
	{
		public static ActionProduceInfestor Instance = new ActionProduceInfestor();
		private ActionProduceInfestor() : base(50, 100, 150, 2) { }
		public override bool HaveTechnology(IBuildOrder bo)
		{
			ZergState state = bo.State as ZergState;
			return state.InfestationPit.Count > 0;
		}
		public override void OnProductionFinished(IBuildOrder bo)
		{
			ZergState state = bo.State as ZergState;
			state.Infestor++;
		}
		public override string EventName { get { return "ActionSpawnInfestor"; } }
		public override bool IsInvalid(Jay.Sc2.Bof.Lib.State.IBuildOrder bo)
		{
			ZergState state = bo.State as ZergState;
			return base.IsInvalid(bo) || state.InfestationPit.Total == 0;
		}
		private IAction[,] m_Requirements;
		public override IAction[,] Requirements
		{
			get
			{
				if (m_Requirements == null)
					m_Requirements = new IAction[,] { { ActionProduceInfestationPit.Instance } };
				return m_Requirements;
			}
		}
	}
}
